home *** CD-ROM | disk | FTP | other *** search
- /*
- File: MssgSI.cpp
-
- Contains: Implementation of Mac specific DefaultAccessorSI class.
-
- Owned by: Nick Pilch
-
- Copyright: © 1994 - 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <5> 12/13/96 JP 1610152: Changed part from null to be part
- from anything
- <4> 10/15/96 JP 1244606, 1375124 : Improved Container &
- added Active Part props.
- <3> 9/26/96 JP 1372897: Fixed 'contains' operation.
- <2> 9/23/96 JP 1384958: Removed SEPriv.h include
- <38> 10/4/95 jpa Added missing ODVolatiles [1285799]
- <37> 25/09/95 NP 1979071: Check results of operator new.
- <36> 9/11/95 NP 1272294: Messaging code cleanup. 1283174:
- Mem leak plugs.
- <35> 9/8/95 jpa eeh: 1269501: Lowercase before string
- comparisons.
- <34> 8/23/95 NP 1276287: Move constant kODAppShell.
- <33> 8/18/95 NP 1274946: Add kODErrCantCountFromLists.
- <32> 8/16/95 eeh 1277001: remove ContainerRepresentsPart
- <31> 8/7/95 NP 1275104: Exception safety.
- <30> 8/3/95 RR #1257260: Collapse B classes. Remove
- somInit methods. Don't call IsInitialized
- or SubclassResponsibility
- <29> 8/1/95 eeh 1265319: accept NULL as representing part
- <28> 7/27/95 eeh 1204615: call TrySwapToRootPart for 'exmn'
- <27> 7/21/95 eeh 1266906: fix CallCountProc; 1262143: call
- ODDisposeAppleEvent
- <26> 6/30/95 JP Release on dispose of standard part token
- <25> 6/28/95 eeh 1262143: dispose AEDescs
- <24> 6/27/95 NP 1263224: Remove Release call in
- DiposeTokenProc for now.
- <23> 6/26/95 NP 1262143: Dispose copy of Apple event made
- in CallEventHandler
- <22> 6/22/95 NP 1261984: Don't delete token after passing
- it to ODNameResolver::DisposeToken!
- <21> 6/20/95 NP Removed dangerous comment.
- <20> 6/19/95 eeh 1246443: add PartFrameFromStandardPartToken
- etc.
- <19> 6/13/95 eeh 1257105: fix string compare
- <18> 6/7/95 eeh 1250399: implement default CompareProc
- <17> 5/21/95 NP 1248898: GetUserToken, ODDescToAEDesc, etc.
- recipe change.
- <16> 5/18/95 eeh 1250061: implement countproc
- <15> 4/28/95 eeh 1244258: IsValid->CheckValid; SOM_TRY
- around it
- <14> 4/27/95 NP 1244309-Default count proc returns -1 only
- if the part is equal to kODAppShell.
- <13> 4/27/95 eeh 1240648: call somSelf->IsValid
- <12> 4/25/95 NP 1186795, 1237220, 1240571: Fixed whose
- clauses by allowing swapping in count proc.
- <11> 4/14/95 NP 1239651: Include SEPriv.h. 1238022: default
- event handler was almost always returning
- noErr.
- <10> 4/7/95 eeh 1236842: call TrySwapToRootPart
- <9> 3/24/95 eeh 1232249: remove frame from
- DEFAULT_ACCESSOR_PARAMS
- <8> 3/21/95 JP 1192027: Include ODRgstry & change some
- constant names
- <7> 3/13/95 NP 1226003: Remove GetContainingFrame from the
- API. Use GetContextFromToken.
- <6> 3/2/95 eeh 1214783: cleanup related to lists
- <5> 2/22/95 eeh 1222901: look for StandardPartToken
- <4> 2/21/95 eeh 1214783: add WildcardFromList accessor;
- change accessor API
- <3> 2/3/95 eeh 1217393: use new ODDesc etc
- <2> 1/27/95 NP 1213948: New classes for ODDesc et al.
- <1> 1/25/95 eeh #1214783-first check-in as unique file.
- <3> 1/11/95 NP #1188520-Pass real ODPart to parts.
- <2> 1/9/95 NP 1194880: MssgSI name changes.
- <1> 11/15/94 NP first checked in
- <7> 9/23/94 NP 1188520-Pass the real ODPart descendent to
- the SemanticInterface extension rather than
- the ODPartWrapper.
- <6> 9/9/94 NP 1185851: implement scripting. 1184040: API
- changes.
- <5> 9/9/94 jpa Removed call to parent in Release, at
- Nick's request. [1185656]
- <4> 7/8/94 NP Initialize fHelper field.
- <3> 7/8/94 NP Fixed bugs, implemented coercion handlers,
- fixed initialization.
- <2> 7/5/94 NP Filled in CallEventHandler.
- <1> 7/1/94 NP first checked in
-
- To Do:
- In Progress:
- */
-
-
- #ifndef _EXCEPT_
- #include "Except.h"
- #endif
-
- #ifndef _DFLTACS_
- #include <DfltAcs.h>
- #endif
-
- #ifndef _ODDESUTL_
- #include <ODDesUtl.h>
- #endif
-
- #ifndef SOM_ODOSLToken_xh
- #include "ODOSLTkn.xh"
- #endif
-
- #ifndef SOM_ODAppleEvent_xh
- #include "ODAplEvt.xh"
- #endif
-
- #ifndef _ODREGISTRY_
- #include "ODRgstry.xh"
- #endif
-
- #ifndef _SEUTILS_
- #include <SEUtils.h>
- #endif
-
- #ifndef SOM_ODNameResolver_xh
- #include <NamRslvr.xh>
- #endif
-
- #ifndef _PASCLSTR_
- #include <PasclStr.h>
- #endif
-
- #define VARIABLE_MACROS
- #define DefaultAccessorSI_Class_Source
- #include <MssgSI.xih>
-
- #ifndef SOM_Module_OpenDoc_StdDefs_defined
- #include <StdDefs.xh>
- #endif
-
- #pragma segment DefaultAccessorSI
-
- //------------------------------------------------------------------------------
- // function prototypes
- //------------------------------------------------------------------------------
-
- static void ResolveDesc( Environment *ev, ODPart* part, ODSession* session,
- ODOSLToken* obj, AEDesc* data );
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::InitCPlusSemanticInterface
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSIInitCPlusSemanticInterface(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* base,
- SIHelperAbs* helper,
- ODSession* session)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSIInitCPlusSemanticInterface");
-
- SOM_TRY
- somSelf->InitSemanticInterface(ev, base, session);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::somUninit
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSIsomUninit(DefaultAccessorSI *somSelf)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSIsomUninit");
-
- DefaultAccessorSI_parents_somUninit(somSelf);
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::InitSemanticInterface
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSIInitSemanticInterface(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* base,
- ODSession* session)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSIInitSemanticInterface");
-
- _fSession = session;
-
- DefaultAccessorSI_parent_ODSemanticInterface_InitSemanticInterface(somSelf, ev, base, session);
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::GetSIHelper
- //------------------------------------------------------------------------------
-
- SOM_Scope SIHelperAbs* SOMLINK DefaultAccessorSIGetSIHelper(DefaultAccessorSI *somSelf, Environment *ev)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSIGetSIHelper");
-
- return kODNULL; // was _fHelper;
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallEventHandler
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallEventHandler(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODAppleEvent* theODAppleEvent,
- ODAppleEvent* reply)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallEventHandler");
-
- OSErr error; //= errAEEventNotHandled;
-
- SOM_TRY
- somSelf->CheckValid(ev);
-
- AppleEvent realMessage;
-
- THROW_IF_ERROR( ODDescToAEDesc(theODAppleEvent, &realMessage) );
-
- AEEventClass eventClass = (AEEventClass)GetSLongAttr(
- &realMessage, keyEventClassAttr);
- AEEventID eventID = (AEEventID)GetSLongAttr(
- &realMessage, keyEventIDAttr);
-
- EventHandlerProc ehp;
-
- if ( (eventClass == kAECoreSuite) && (eventID == kAEGetData) )
- ehp = HandleGetData;
- else if ( (eventClass == kAECoreSuite) && (eventID == kAESetData) )
- ehp = HandleSetData;
- else
- ehp = kODNULL;
-
- if ( ehp )
- error = (*ehp)( ev, thePart, theODAppleEvent, reply, _fSession );
- else
- error = errAEEventNotHandled;
-
- ODDisposeAppleEvent(&realMessage);
-
- THROW_IF_ERROR( error );
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallCoercionHandler
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallCoercionHandler(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODDesc* theODDesc,
- ODDescType toType,
- ODDesc* result)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallCoercionHandler");
-
- OSErr error = errAECoercionFail;//= CallCoercionHandler(thePart, theODDesc, toType, result);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallCoercionHandler not implemented" );
- THROW( error );
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallObjectAccessor
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallObjectAccessor(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODDescType desiredClass,
- ODOSLToken* container,
- ODDescType containerClass,
- ODDescType form,
- ODDesc* selectionData,
- ODOSLToken* value)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallObjectAccessor");
-
- OSErr error;
- SOM_TRY
- somSelf->CheckValid(ev);
-
- ODDesc* userTokenWrapper = kODNULL;
-
- AEDesc realToken = NULL_DESCRIPTOR_DEFINITION;
- DescType containerType = typeNull;
- ODNameResolver* resolver = _fSession->GetNameResolver(ev);
-
- ASSERT(resolver->IsODToken( ev, container ), kODTrue);
- userTokenWrapper = resolver->GetUserToken(ev, container);
- THROW_IF_ERROR(ODDescToAEDesc(userTokenWrapper, &realToken ));
- containerType = realToken.descriptorType;
-
- error = errAEAccessorNotFound;
- PartAccessorProc pac;
-
- if ( (containerType == kODStandardPartTokenType)
- || CanBeStandardPartToken( &realToken ) )
- pac = GetWildcardFromPart;
- else if ( containerType == typeAEList )
- pac = GetWildcardFromList;
- else if ( (desiredClass == cPart) /* && (containerType == typeNull)*/ )
- pac = GetPartFromNULL;
- else if ( (desiredClass == cProperty) && (containerType == typeNull) )
- pac = GetPropFromNULL;
- else if ( (desiredClass == cProperty) && (containerType == cProperty) )
- pac = GetPropFromProp;
- else if ( (thePart == kODAppShell) && ((containerType == typeNull)
- || (containerType == typeObjectBeingExamined)) )
- pac = TrySwapToRootPart;
- else
- pac = kODNULL;
-
- if ( pac )
- {
- // We have to pass value as an ODOSLToken* in case the accessor
- // needs to call CreateSwapToken on it.
-
- error = (*pac)( ev, thePart, desiredClass, &realToken,
- containerClass, form, selectionData, value,
- _fSession );
- }
- (void)AEDisposeDesc( &realToken );
- THROW_IF_ERROR( error );
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallPredispatchProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallPredispatchProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODAppleEvent* theODAppleEvent,
- ODAppleEvent* reply)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallPredispatchProc");
-
- OSErr error = errAEEventNotHandled;//= CallPredispatchProc(thePart, theODAppleEvent, reply);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallPredispatchProc not implemented" );
- THROW_IF_ERROR( error );
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallCompareProc
- //------------------------------------------------------------------------------
-
-
- SOM_Scope void SOMLINK DefaultAccessorSICallCompareProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODDescType oper,
- ODOSLToken* obj1,
- ODOSLToken* obj2,
- ODBoolean* result)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallCompareProc");
-
- OSErr error = errAEEventNotHandled;
- AEDesc obj1AsData, obj2AsData, tmpDesc;
-
- SOM_TRY
- somSelf->CheckValid(ev);
-
- obj1AsData.dataHandle = obj2AsData.dataHandle = tmpDesc.dataHandle =
- kODNULL;
- ODNameResolver* resolver = _fSession->GetNameResolver(ev);
- ResolveDesc( ev, thePart, _fSession, obj1, &obj1AsData );
- ResolveDesc( ev, thePart, _fSession, obj2, &obj2AsData );
-
- // use CompareDescs in SEUtils
- *result = CompareDescs(&obj1AsData, oper, &obj2AsData);
-
- SOM_CATCH_ALL
- (void)AEDisposeDesc( &obj1AsData );
- (void)AEDisposeDesc( &obj2AsData );
- (void)AEDisposeDesc( &tmpDesc );
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallCountProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallCountProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODDescType desiredType,
- ODDescType containerClass,
- ODOSLToken* container,
- ODSLong* result)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallCountProc");
-
- // ASK TO SWAP TO SEE IF ROOT PART CAN HANDLE THIS. CallCountProc in
- // NamRslvr.cpp WILL SWAP TO THE ROOT PART IF kODCountProcSwapValue IS
- // RETURNED AND THE PART IS THE SHELL. THIS IS NOT THAT GREAT, SEEING AS
- // THE DEFAULT SEMANTIC INTERFACE SHOULD REALLY BE DETERMINING WHAT THE
- // PROPER PART TO SWAP TO IS.
- SOM_TRY
- somSelf->CheckValid(ev);
- ODNameResolver* resolver = _fSession->GetNameResolver(ev);
-
- if ( thePart == kODAppShell)
- *result = kODCountProcSwapValue;
- else if ( resolver->IsODToken( ev, container ) )
- {
- ODError error = noErr;
- ODDesc* tmpToken = resolver->GetUserToken(ev, container);
- switch( tmpToken->GetDescType(ev) )
- {
- case typeAEList:
- error = kODErrCantCountFromLists;
- break;
- case kODStandardPartTokenType:
- // (NULL token is not acceptable here)
- // <eeh> putting NULL back in because this breaks "every part
- // whose" when the root isn't scriptable.
- case typeNull:
- // do the count;
- break;
- default:
- {
- AEDesc token;
- THROW_IF_ERROR( ODDescToAEDesc( tmpToken, &token ) );
- if ( !CanBeStandardPartToken( &token ) )
- error = errAEEventNotHandled;
- (void)AEDisposeDesc( &token );
- }
- }
- if ( error == noErr )
- {
- if ( desiredType != cPart )
- *result = kODCountProcSwapValue;
- else
- *result = CountEmbeddedParts(ev, thePart);
- }
- else
- THROW( error );
- }
-
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallDisposeTokenProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallDisposeTokenProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODOSLToken* unneededToken)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallDisposeTokenProc");
-
- SOM_TRY
- somSelf->CheckValid(ev);
-
- ODNameResolver* resolver = _fSession->GetNameResolver(ev);
- if ( resolver->IsODToken( ev, unneededToken ) )
- {
- ODDesc* realTokenODDesc = resolver->GetUserToken( ev, unneededToken );
- AEDesc realToken;
- THROW_IF_ERROR(ODDescToAEDesc(realTokenODDesc, &realToken ));
- DescType containerType = realToken.descriptorType;
-
- if ( containerType == typeAEList )
- {
- long count;
- THROW_IF_ERROR( AECountItems( &realToken, &count ) );
-
- for ( ODUShort index = 1; index <= count ; ++index )
- {
- AEDesc oneToken;
- DescType tokenDescType;
- THROW_IF_ERROR( AEGetNthDesc( &realToken, index, typeWildCard,
- &tokenDescType, &oneToken ) );
- ODOSLToken* subToken = new ODOSLToken();
- THROW_IF_NULL(subToken);
- subToken->InitODOSLToken(ev);
- THROW_IF_ERROR( AEDescToODDesc( &oneToken, subToken ) );
- (void)AEDisposeDesc( &oneToken );
- // <eeh> don't I need to call back into the resolver for this?
- // It could be someone else's token!
- TRY
- resolver->DisposeToken( ev, subToken );
- // somSelf->CallDisposeTokenProc( ev, thePart, subToken );
- CATCH_ALL
- // <eeh> just ignore errors here....I think.
- ENDTRY
- }
- }
- else if ( containerType == cPart ) // a standard part token
- {
- ODPart* part;
- ODFrame* frame;
-
- PartFrameFromStandardPartToken( &realToken, &part, &frame );
- // BOTH THE PART AND FRAME DO NEED TO BE RELEASED HERE.
- ODReleaseObject( ev, part );
- ODReleaseObject( ev, frame );
- // leave error as errAEEventNotHandled so handle disposed
- }
-
- // now dispose the *copy* we've made! This isn't the token
- // itself. Hell, how *could* we dispose it?
- (void)AEDisposeDesc( &realToken );
- }
-
- // LET MESSAGING DISPOSE unneededToken itself.
- THROW(errAEEventNotHandled);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallGetErrDescProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallGetErrDescProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODDesc** errDesc)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallGetErrDescProc");
-
- OSErr error = errAEEventNotHandled;// = CallGetErrDescProc(thePart, errDesc);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallGetErrDescProc not implemented" );
- THROW_IF_ERROR(error);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallGetMarkTokenProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallGetMarkTokenProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODOSLToken* dContainerToken,
- ODDescType containerClass,
- ODOSLToken* result)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallGetMarkTokenProc");
-
- OSErr error = errAEEventNotHandled;// = CallGetMarkTokenProc(thePart, dContainerToken,
- // containerClass, result);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallGetMarkTokenProc not implemented" );
- THROW_IF_ERROR(error);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallMarkProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallMarkProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODOSLToken* dToken,
- ODOSLToken* markToken,
- ODSLong index)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallMarkProc");
-
- OSErr error = errAEEventNotHandled;// = CallMarkProc(thePart, dToken, markToken, index);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallMarkProc not implemented" );
- THROW_IF_ERROR(error);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // DefaultAccessorSI::CallAdjustMarksProc
- //------------------------------------------------------------------------------
-
- SOM_Scope void SOMLINK DefaultAccessorSICallAdjustMarksProc(DefaultAccessorSI *somSelf, Environment *ev,
- ODPart* thePart,
- ODSLong newStart,
- ODSLong newStop,
- ODOSLToken* markToken)
- {
- DefaultAccessorSIData *somThis = DefaultAccessorSIGetData(somSelf);
- DefaultAccessorSIMethodDebug("DefaultAccessorSI","DefaultAccessorSICallAdjustMarksProc");
-
- OSErr error = errAEEventNotHandled;// = CallAdjustMarksProc(thePart, newStart, newStop, markToken);
- SOM_TRY
- somSelf->CheckValid(ev);
- WARN( "DefaultAccessorSICallAdjustMarksProc not implemented" );
- THROW_IF_ERROR(error);
- SOM_CATCH_ALL
- SOM_ENDTRY
- }
-
- //------------------------------------------------------------------------------
- // Utility functions
- //------------------------------------------------------------------------------
-
- static void ResolveDesc( Environment *ev, ODPart* part, ODSession* session,
- ODOSLToken* obj, AEDesc* data )
- {
- ODNameResolver* resolver = session->GetNameResolver(ev);
-
- if ( resolver->IsODToken( ev, obj ) )
- {
- AEDesc userToken, tmpDesc;
- AERecord fakeReply, fakeAEVT;
- userToken.dataHandle = tmpDesc.dataHandle = fakeReply.dataHandle =
- fakeAEVT.dataHandle = NULL;
- ODAppleEvent* odreply, *odaevt; ODVolatile(odaevt);
- odreply = odaevt = kODNULL; ODVolatile(odreply);
-
- TRY
- ODDesc* userTokenHolder = resolver->GetUserToken( ev, obj );
- THROW_IF_ERROR( ODDescToAEDesc( userTokenHolder, &userToken ) );
- if ( userToken.descriptorType == cProperty )
- {
- (void)AEDisposeDesc( &userToken );
-
- THROW_IF_ERROR( ODDescToAEDesc( obj, &tmpDesc ) );
- THROW_IF_ERROR( AECreateList( NULL, 0, kODTrue, &fakeAEVT ) );
- THROW_IF_ERROR( AEPutParamDesc( &fakeAEVT, keyDirectObject,
- &tmpDesc ) );
- (void)AEDisposeDesc( &tmpDesc );
- odaevt = new ODAppleEvent();
- THROW_IF_NULL(odaevt);
- odaevt->InitODAppleEvent( ev );
- THROW_IF_ERROR( AEDescToODDesc( &fakeAEVT, odaevt ));
- (void)AEDisposeDesc( &fakeAEVT );
-
- THROW_IF_ERROR( AECreateList( NULL, 0, kODTrue, &fakeReply ) );
- odreply = new ODAppleEvent();
- THROW_IF_NULL(odreply);
- odreply->InitODAppleEvent( ev );
- THROW_IF_ERROR( AEDescToODDesc( &fakeReply, odreply ));
- (void)AEDisposeDesc( &fakeReply );
-
- THROW_IF_ERROR( HandleGetData( ev, part, odaevt, odreply,
- session ) );
- ODDeleteObject( odaevt );
-
- THROW_IF_ERROR( ODDescToAEDesc( odreply, &fakeReply ));
- THROW_IF_ERROR( AEGetParamDesc( &fakeReply, keyDirectObject,
- typeWildCard, data ) );
- (void)AEDisposeDesc( &fakeReply );
- ODDeleteObject( odreply );
- }
- else
- {
- *data = userToken;
- }
- CATCH_ALL
- (void)AEDisposeDesc( &userToken );
- (void)AEDisposeDesc( &tmpDesc );
- (void)AEDisposeDesc( &fakeReply );
- (void)AEDisposeDesc( &fakeAEVT );
- ODDeleteObject( odaevt );
- ODDeleteObject( odreply );
- RERAISE;
- ENDTRY
- }
- else
- {
- THROW_IF_ERROR( ODDescToAEDesc( obj, data ) );
- }
- }
-
-
-
-